home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / tcqbsnip.zip / DAISIES.BAS < prev    next >
BASIC Source File  |  1997-06-20  |  2KB  |  73 lines

  1. ' Daisy Patch
  2. ' By Tika Carr
  3. ' June 20, 1997
  4. '
  5. ' Public Domain: No warranties or Guarantees are expressed or implied
  6.  
  7. DECLARE SUB Daisies (Col%, Row%, Radius%, Aspect!, Colour%, Petals%)
  8. DEFINT A-Z
  9.  
  10. SCREEN 12  ' 640 x 480 VGA
  11.  
  12. 'Daisies x, y, Radius, Aspect, Color, Petals
  13.  
  14. LINE (0, 0)-(640, 480), 2, BF  'Clear Screen to green    
  15. PALETTE 1, 2965311             'Cream Petals
  16. PALETTE 3, 2045759             'Gold Petals
  17.  
  18. FOR i = 1 TO 10 ' Put 10 daisies on the screen
  19.  
  20.   x = INT(RND * 540) + 50
  21.   y = INT(RND * 380) + 50
  22.   s = INT(RND * 50) + 10
  23.  
  24.   Daisies x, y, s, 1, 15, 10   ' White Petals
  25.   Daisies x, y, s, .5, 1, 10   ' Cream Petals
  26.   Daisies x, y, s, 3, 3, 10    ' Gold Petals
  27.  
  28. NEXT
  29.  
  30. BEEP ' Done!
  31.  
  32. P$ = INPUT$(1): SCREEN 0, 0, 0, 0: COLOR 7, 0: CLS : END
  33.  
  34. SUB Daisies (Col, Row, Radius, Aspect!, Colour, Petals)
  35.  
  36. 'The original author of this subroutine is unknown. If anyone knows who
  37. 'wrote it, please let me know!
  38.  
  39. i = (360 \ Petals)
  40. Pi2! = (8 * ATN(1))
  41. Srad! = StartD! - (90 \ Petals) - 90
  42. XRad! = Radius
  43. YRad! = Radius
  44.  
  45. IF Aspect! > 1 THEN
  46.   XRad! = Radius / Aspect!
  47. ELSEIF Aspect! < 1 THEN
  48.   YRad! = Radius * Aspect!
  49. END IF
  50.  
  51. Srad! = Srad! + (180 \ Petals)
  52. Sr! = Srad! * (Pi2! / 360)
  53.  
  54. PSET (Col, Row), Colour   'Start Point
  55.  
  56.  
  57. FOR T! = .01 TO Pi2! STEP .01
  58.   'formula
  59.  
  60.   L! = SIN(Petals * T!)
  61.   R! = XRad! * L!
  62.  
  63.   x = Col + (R! * COS(T! - Sr!))
  64.   IF Aspect! <> 1 THEN R! = YRad! * L!
  65.   y = Row - (R! * SIN(T! - Sr!))
  66.  
  67.   LINE -(x, y), Colour
  68.  
  69. NEXT
  70.  
  71. END SUB
  72.  
  73.